package com.wulijie.iterator;

import java.util.Iterator;

/**
 * @Author cui
 * @Data
 */
public class ComputerCollege implements College{
    private Department[] departmentList;

    private int position = 0;

    public ComputerCollege() {
        departmentList = new Department[5];
        addDepartment("java", "java");
        addDepartment("php", "php");
        addDepartment("c#", "c#");
    }

    @Override
    public void addDepartment(String name, String desc) {
        departmentList[position] = new Department(name, desc);
        position += 1;
    }

    @Override
    public Iterator createIterator() {
        return new ComputerIterator(this.departmentList);
    }

    @Override
    public String getName() {
        return "计算机学院";
    }
}
